package com.ibsolutions.epersely;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

public class FirstStepsActivity extends Activity {
	
	private TransactionMgr transactionMgr;
	
	private EditText budgetField;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.first_steps);
		budgetField = (EditText)findViewById(R.id.budget_text_field);
		transactionMgr = new TransactionMgr(this);
	}
	
	public void onClick(View view) {
		if (view.getId() == R.id.first_step_ok) {
			int budget = Integer.parseInt(budgetField.getText().toString());
			transactionMgr.open();
			transactionMgr.updateMeta("first", 0);
			transactionMgr.updateMeta("budget", budget);
			transactionMgr.close();
			Log.i("FirstSteps", "First key updated to 0");
			Log.i("FirstSteps", "Budget updated to " + budget);
			finish();
		}
	}
}
